﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <Style x:Key="{x:Type Menu}" TargetType="{x:Type Menu}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
        <Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
        <Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
        <Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border Background="Transparent" BorderBrush="Transparent" BorderThickness="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>




    <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
    <Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
    <Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
    <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>


    <PathGeometry x:Key="Checkmark">
        <PathGeometry.Figures>
            <PathFigureCollection>
                <PathFigure StartPoint="0 2" IsClosed="True" IsFilled="True">
                    <PathFigure.Segments>
                        <PathSegmentCollection>
                            <LineSegment Point="0 4.8"/>
                            <LineSegment Point="2.5 7.4"/>
                            <LineSegment Point="7.1 2.8"/>
                            <LineSegment Point="7.1 0"/>
                            <LineSegment Point="2.5 4.6"/>
                        </PathSegmentCollection>
                    </PathFigure.Segments>
                </PathFigure>
            </PathFigureCollection>
        </PathGeometry.Figures>
    </PathGeometry>


    <Style x:Key="MenuScrollButton" TargetType="{x:Type RepeatButton}" BasedOn="{x:Null}">
        <Setter Property="ClickMode" Value="Hover"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <DockPanel Background="Transparent" SnapsToDevicePixels="true">
                        <Rectangle DockPanel.Dock="Right" x:Name="R1" Width="1" Fill="Transparent"/>
                        <Rectangle DockPanel.Dock="Bottom" x:Name="B1" Height="1" Fill="Transparent"/>
                        <Rectangle DockPanel.Dock="Left" x:Name="L1" Width="1" Fill="Transparent"/>
                        <Rectangle DockPanel.Dock="Top" x:Name="T1" Height="1" Fill="Transparent"/>
                        <ContentPresenter x:Name="ContentContainer" Margin="2,2,2,2" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="R1"
                                    Property="Fill"
                                    Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                            <Setter TargetName="B1"
                                    Property="Fill"
                                    Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                            <Setter TargetName="L1"
                                    Property="Fill"
                                    Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                            <Setter TargetName="T1"
                                    Property="Fill"
                                    Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                            <Setter TargetName="ContentContainer"
                                    Property="Margin"
                                    Value="3,3,1,1"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}"
           TargetType="{x:Type ScrollViewer}"
           BasedOn="{x:Null}">
        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="1" Grid.Column="0">
                            <ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
                        </Border>
                        <RepeatButton
                                      Style="{StaticResource MenuScrollButton}"
                                      Grid.Row="0"
                                      Grid.Column="0"
                                      Command="{x:Static ScrollBar.LineUpCommand}"
                                      CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                      Focusable="false">
                            <RepeatButton.Visibility>
                                <MultiBinding FallbackValue="Visibility.Collapsed"
                                              Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                              ConverterParameter="0">
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ComputedVerticalScrollBarVisibility"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="VerticalOffset"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ExtentHeight"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ViewportHeight"/>
                                </MultiBinding>
                            </RepeatButton.Visibility>
                            <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"
                                  Data="{StaticResource UpArrow}"/>
                        </RepeatButton>
                        <RepeatButton
                                      Style="{StaticResource MenuScrollButton}"
                                      Grid.Row="2"
                                      Grid.Column="0"
                                      Command="{x:Static ScrollBar.LineDownCommand}"
                                      CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                      Focusable="false">
                            <RepeatButton.Visibility>
                                <MultiBinding FallbackValue="Visibility.Collapsed"
                                              Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                              ConverterParameter="100">
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ComputedVerticalScrollBarVisibility"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="VerticalOffset"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ExtentHeight"/>
                                    <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ViewportHeight"/>
                                </MultiBinding>
                            </RepeatButton.Visibility>
                            <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"
                                  Data="{StaticResource DownArrow}"/>
                        </RepeatButton>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="Background" Value="{DynamicResource HighlightLightBrush}"/>
        <Setter Property="MinHeight" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="Opacity" Value="0.8"/>
        <Setter Property="Margin" Value="1 0 1 0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=SubmenuContent}"
                     TargetType="{x:Type ContentControl}">
        <Border Background="{DynamicResource AccentColorBrush2}" BorderThickness="1" BorderBrush="{DynamicResource AccentColorBrush2}">
            <ContentPresenter/>
        </Border>
    </ControlTemplate>
    
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border Background="Transparent" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" SnapsToDevicePixels="true" Opacity="1">
            <DockPanel>
                <ContentPresenter x:Name="Icon" Margin="4,0,6,0" VerticalAlignment="Center" ContentSource="Icon"/>
                <Path x:Name="GlyphPanel" Margin="4,0,6,0" Visibility="Collapsed" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Data="{StaticResource Checkmark}"/>
                <ContentPresenter ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible"/>
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
                <Setter Property="Opacity" Value="1" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="false">
                <Setter Property="Opacity" Value=".5" />
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrush}}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelHeaderTemplateKey}"
                     TargetType="{x:Type MenuItem}">
        <Border Background="Transparent" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" SnapsToDevicePixels="true">
            <DockPanel>
                <ContentPresenter x:Name="Icon" Margin="4,0,6,0" VerticalAlignment="Center" ContentSource="Icon"/>
                <Path x:Name="GlyphPanel"
                      Margin="4,0,6,0"
                      Visibility="Collapsed"
                      VerticalAlignment="Center"
                      Fill="{TemplateBinding Foreground}"
                      FlowDirection="LeftToRight"
                      Data="{StaticResource Checkmark}"/>
                <ContentPresenter ContentSource="Header"
                                  Margin="{TemplateBinding Padding}"
                                  RecognizesAccessKey="True"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <Popup x:Name="PART_Popup"
                       AllowsTransparency="true"
                       Placement="Bottom"
                       IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}"
                       Focusable="false"
                       PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">                    
                        <Border Name="SubMenuBorder"
                                Background="{DynamicResource AccentColorBrush2}"
                                BorderThickness="1"
                                BorderBrush="{DynamicResource AccentColorBrush2}">
                            <ScrollViewer Name="SubMenuScrollViewer" CanContentScroll="true"
                                          Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                <Grid RenderOptions.ClearTypeHint="Enabled">
                                    <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                        <Rectangle
                                        Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}" 
                                        Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}" 
                                        Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                    </Canvas>
                                    <ItemsPresenter Name="ItemsPresenter" Margin="2"
                                                KeyboardNavigation.TabNavigation="Cycle"
                                                KeyboardNavigation.DirectionalNavigation="Cycle"
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                Grid.IsSharedSizeScope="true"/>
                                </Grid>
                            </ScrollViewer>
                        </Border>
                </Popup>
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None"/>
            </Trigger>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible"/>
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>            
            <Trigger Property="IsHighlighted" Value="true">
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
                <Setter Property="Opacity" Value="1" />
                <Setter Property="IsSubmenuOpen" Value="True"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="false">
                <Setter Property="Opacity" Value=".5" />
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrush}}"/>
            </Trigger>           
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuItemTemplateKey}"
                     TargetType="{x:Type MenuItem}">
        <Border Background="{DynamicResource AccentColorBrush2}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource AccentColorBrush2}" SnapsToDevicePixels="true">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
                    <ColumnDefinition Width="14"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon" Margin="4,0,6,0" VerticalAlignment="Center" ContentSource="Icon" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <Path x:Name="GlyphPanel" Margin="4,0,6,0" Visibility="Hidden" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Data="{StaticResource Checkmark}" Opacity="0.5"/>
                <ContentPresenter Grid.Column="1" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" Margin="5,2,0,2" DockPanel.Dock="Right"/>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible"/>
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
                <Setter Property="Opacity" Value="1" />
                
            </Trigger>
            <Trigger Property="IsHighlighted" Value="false">
                <Setter Property="Opacity" Value=".5" />
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrush}}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuHeaderTemplateKey}"
                     TargetType="{x:Type MenuItem}">
        <Border Background="{DynamicResource AccentColorBrush2}"
                BorderThickness="{TemplateBinding BorderThickness}"
                BorderBrush="{DynamicResource AccentColorBrush2}"
                SnapsToDevicePixels="true">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="17"
                                      Width="Auto"
                                      SharedSizeGroup="MenuItemIconColumnGroup"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"
                                      SharedSizeGroup="MenuItemIGTColumnGroup"/>
                    <ColumnDefinition Width="14"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon"
                                  Margin="4,0,6,0"
                                  VerticalAlignment="Center"
                                  ContentSource="Icon"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <Path x:Name="GlyphPanel"
                      Margin="4,0,6,0"
                      Visibility="Hidden"
                      VerticalAlignment="Center"
                      Fill="{TemplateBinding Foreground}"
                      FlowDirection="LeftToRight"
                      Data="{StaticResource Checkmark}"/>
                <ContentPresenter Grid.Column="1"
                                  ContentSource="Header"
                                  Margin="{TemplateBinding Padding}"
                                  RecognizesAccessKey="True"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                <Path
                      Grid.Column="3"
                      DockPanel.Dock="Right"
                      VerticalAlignment="Center"
                      Margin="4,0,6,0"
                      Fill="{TemplateBinding Foreground}"
                      Data="{StaticResource RightArrow}"/>
                <Popup x:Name="PART_Popup"
                       AllowsTransparency="true"
                       Placement="Right"
                       VerticalOffset="-3"
                       IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}"
                       Focusable="false"
                       PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
                    <!--<theme:SystemDropShadowChrome Name="Shdw"
                                                  Color="Transparent">-->
                    <Border Name="SubMenuBorder" Background="{DynamicResource AccentColorBrush2}"
                                BorderThickness="1"
                                BorderBrush="{DynamicResource AccentColorBrush2}">
                            <ScrollViewer Name="SubMenuScrollViewer" CanContentScroll="true"
                                          Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                <Grid RenderOptions.ClearTypeHint="Enabled">
                                    <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                        <Rectangle
                                        Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}" 
                                        Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}" 
                                        Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                    </Canvas>
                                    <ItemsPresenter Name="ItemsPresenter" Margin="2"
                                                KeyboardNavigation.TabNavigation="Cycle"
                                                KeyboardNavigation.DirectionalNavigation="Cycle"
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                Grid.IsSharedSizeScope="true"/>
                                </Grid>
                            </ScrollViewer>
                        </Border>
                    <!--</theme:SystemDropShadowChrome>-->
                </Popup>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None"/>
            </Trigger>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible"/>
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger SourceName="PART_Popup" Property="Popup.HasDropShadow" Value="False">
              
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
                <Setter Property="Opacity" Value="1" />
                <Setter Property="IsSubmenuOpen" Value="True"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="false">
                <Setter Property="Opacity" Value=".5" />
                <Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource MenuItemDisabledBrush}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="mentroContextMenu" TargetType="ContextMenu">
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
        <Setter Property="HasDropShadow" Value="False"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContextMenu">
                    <Border  Name="Border" Background="{DynamicResource AccentDarkColorBrush}" BorderBrush="{DynamicResource AccentColorBrush2}"  BorderThickness="1" >
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                    </Border>
                    <!--<ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="true">
                            <Setter TargetName="Border" Property="Padding" Value="0,3,0,3"/>
                            <Setter TargetName="Border" Property="CornerRadius" Value="0"/>
                        </Trigger>
                    </ControlTemplate.Triggers>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>
    <Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
        <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{DynamicResource HighlightLightBrush}"/>
        <Setter Property="ScrollViewer.PanningMode"
                Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled"
                Value="False"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuItemTemplateKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource HighlightLightColor}"/>
        <Setter Property="Opacity" Value="0.75" />
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Margin" Value="0,1,0,1"/>
                <Setter Property="Padding" Value="6,3,6,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelHeaderTemplateKey}}"/>
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Margin" Value="0,1,0,1"/>
                <Setter Property="Padding" Value="6,3,6,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelItemTemplateKey}}"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="DockPanel.Dock" Value="Top"/>
                <Setter Property="Padding" Value="0,2,0,2"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuHeaderTemplateKey}}"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="DockPanel.Dock" Value="Top"/>
                <Setter Property="Padding" Value="0,2,0,2"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">                
                <Setter Property="Opacity" Value="1" />
             </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource MenuItemDisabledBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>


</ResourceDictionary>